<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
</head>
<style type="text/css">
.priceSize input {
	display: inline-block;
	width: 20% !important;
	float: left !important;
}
</style>
<form class="mui-input-group">
	<div class="mui-input-row">
		<label>名称:</label> <input type="text" class="layui-input Name"
			id="name" name="name" value="${manageCaseType.name }"
			placeholder="名称"> <input type="hidden" name=typeId
			value="${manageCaseType.typeId }">
	</div>
	<div class="mui-input-row">
		<label>计费方式:</label> <select name="payType" class="selectPayType"
			id="demo">
			<c:if test="${manageCaseType.payType == 0}">
				<option value="0" selected="selected">免费</option>
				<option value="1">计时</option>
				<option value="2">计次</option>
			</c:if>
			<c:if test="${manageCaseType.payType == 1}">
				<option value="0">免费</option>
				<option value="1" selected="selected">计时</option>
				<option value="2">计次</option>
			</c:if>
			<c:if test="${manageCaseType.payType == 2}">
				<option value="0">免费</option>
				<option value="1">计时</option>
				<option value="2" selected="selected">计次</option>
			</c:if>
		</select>
	</div>
	<div class="mui-input-row">
		<label>收费时间:</label> <select name="payTime">
			<c:if test="${manageCaseType.payTime == 1}">
				<option value="1" selected="selected">使用后</option>
				<option value="2">使用前</option>
			</c:if>
			<c:if test="${manageCaseType.payTime == 2}">
				<option value="1">使用后</option>
				<option value="2" selected="selected">使用前</option>
			</c:if>
		</select>
	</div>
	<div class="mui-input-row 1 2">
		<label>价格:</label> <input type="number" min="0.0" step="0.1"
			class="layui-input 12 price" value="${manageCaseType.price}"
			name="price" placeholder="请输入价格">
	</div>
	<div class="mui-input-row 1 2">
		<label>价格:</label> <input type="number" min="0.0" step="0.1"
			class="layui-input 12 price" value="${manageCaseType.cashPledge}"
			name="cashPledge" placeholder="请输入价格">
	</div>
	<div class="mui-input-row 1 2 priceSize">
		<label>价格<span style="font-size: 12px;">(大中小):</span></label> <input
			type="number" min="0.0" step="0.1" class="layui-input price-1"
			value="${priceSize[0]}" name="priceSize" placeholder="大"> <input
			type="number" min="0.0" step="0.1" class="layui-input price-2"
			value="${priceSize[1]}" name="priceSize" placeholder="中"> <input
				type="number" min="0.0" step="0.1" class="layui-input price-3"
				value="${priceSize[2]}" name="priceSize" placeholder="小">
	</div>
	<div class="mui-input-row 1 ">
		<label>计时单位:</label> <input type="number" min="0.0" step="0.1"
			class="layui-input userTime" value="${manageCaseType.userTime}"
			name="userTime" placeholder="此价格使用的时间（计时）">
	</div>
	<div class="mui-input-row">
		<label>公司:</label> <select class="comp" name="compId">
			<option value="${manageCaseType.compId}">${list.compName}</option>
			<c:forEach items="${compList}" var="list">
				<c:if test="${list.compId == manageCaseType.compId}">
					<option value="${list.compId }" selected="selected">${list.compName}</option>
				</c:if>
				<c:if test="${list.compId != manageCaseType.compId}">
					<option value="${list.compId }">${list.compName}</option>
				</c:if>
			</c:forEach>
		</select>
	</div>
	<div class="mui-button-row">
		<a type="button" class="mui-btn mui-btn-primary submit">提交</a>
	</div>
</form>
<script type="text/javascript">
        mui('#offCanvasContentScroll').scroll().scrollTo(0,0);
        
        $(".mui-title").html("修改计费类型");
		//计费方式
		selectPayType();
		
		$('.selectPayType').on('change',function(){
			selectPayType();
		});
		
		function selectPayType(){
			//判断是否选取prompt属性，无返回值；
	        var param = $(".selectPayType").find('option:selected').val();
	        if(param==0){
				$(".1").hide();
			}else if(param==1){
				$(".1").show();
			}else{
				$(".1").hide();
				$(".2").show();
			}
		}
		
	   
	   $(".submit").on("touchstart",function(){
		   var param=$("form").serialize();

		   	$.post("/caseType/editCaseTyep",param,function(res){
				
				if(res.success){
					mui.toast("修改成功");
					history.back();
		    	}else{
		    		mui.toast(res.message);
		    	}
				
			})
	   })
	   
	</script>
</html>